package com.lang.datasource.service.impl;

import com.lang.datahandler.service.DatasourceHandler;
import com.lang.datahandler.service.HandlerFactory;
import com.lang.datasource.service.DatasourceService;
import com.lang.dto.datasource.BaseDataSourceDto;
import org.springframework.stereotype.Service;

/**
 * creat by SimonLang
 * 2022/12/30 21:33
 */

@Service
public class DatasourceServiceImpl implements DatasourceService {
    @Override
    public BaseDataSourceDto preconnect(BaseDataSourceDto baseDataSourceDto) {
        DatasourceHandler<?> datasourceHandler = HandlerFactory.getHandlerByType(baseDataSourceDto.getDataSourceType());
        datasourceHandler.preconnect(baseDataSourceDto);
        return baseDataSourceDto;
    }
}

